package com.gs;

import java.awt.BorderLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.util.EventObject;

import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.UIManager;

import org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper;
import org.jdesktop.application.Application;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.View;

import com.gs.control.MainControl;
import com.gs.view.database.DatabasePanel;

public class GsTool extends SingleFrameApplication{

	private Application app;
	public static String title;
	 private ResourceMap resourceMap;
	// GUI components
    private JPanel mainPanel;
   // private DemoSelectorPanel demoSelectorPanel;
    //private AnimatingSplitPane demoSplitPane;
    private JPanel demoContainer;
    private JComponent currentDemoPanel;
    private JComponent demoPlaceholder;
    private JPanel codeContainer;
    //private CodeViewer codeViewer;    
    //private JCheckBoxMenuItem sourceCodeCheckboxItem;
    //private ButtonGroup lookAndFeelRadioGroup;
	private MainControl mainControl;
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		launch(GsTool.class, args);
	}

	@Override
	public void exit(EventObject arg0) {
		// TODO Auto-generated method stub
		System.out.println("退出");
		super.exit(arg0);
	}

	@Override
	protected void startup() {
		// TODO Auto-generated method stub
		System.out.println("sta");
		View view = getMainView();
		//view.set
        view.setComponent(createMainPanel());
        //view.setMenuBar(createMenuBar());
        getContext().getResourceMap();
        //applyDefaults();
        
        // application framework should handle this
        //getMainFrame().setIconImage(resourceMap.getImageIcon("Application.icon").getImage());
        //show(new DatabasePanel(this));
        show(view);     
	}

	private JComponent createMainPanel() {
		
		DatabasePanel dbPanel=new DatabasePanel(this);
		 mainPanel = new JPanel();
		 
	       mainPanel.add(dbPanel.getJPanel());
		return mainPanel;
	}

	@Override
	protected void initialize(String[] args) {
		//app=new 
		System.out.println("ini");
		// TODO Auto-generated method stub
		try {
   
		 BeautyEyeLNFHelper.frameBorderStyle=BeautyEyeLNFHelper.FrameBorderStyle.generalNoTranslucencyShadow; 
        	BeautyEyeLNFHelper.launchBeautyEyeLNF();
        	UIManager.put("RootPane.setupButtonVisible", false);
        	
        } catch (Exception ex) {
            // not catestrophic
        }
		resourceMap = getContext().getResourceMap();
        
        title = resourceMap.getString("mainFrame.title");
     //   mainControl=new MainControl();
     //   mainControl.getMyEclipseConfig();
      //  IntroPanel intro = new IntroPanel();
        //setDemoPlaceholder(intro);
	}
public static GsTool getApplication() {

    return Application.getInstance(GsTool.class);

}
}
